<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  
  <meta name="generator" content="Hugo 0.98.0" />

  
  <meta name="description" content="走在通往幸福的路上">
  

  
  <link rel="apple-touch-icon" sizes="180x180" href="https://blog.v5u.win/apple-touch-icon.png">

  
  <link rel="icon" type="image/png" sizes="32x32" href="https://blog.v5u.win/favicon-32x32.png">

  
  <link rel="icon" type="image/png" sizes="16x16" href="https://blog.v5u.win/favicon-16x16.png">

  
  <link rel="manifest" href="https://blog.v5u.win/site.webmanifest">

  
  <link rel="mask-icon" href="https://blog.v5u.win/safari-pinned-tab.svg" color="">

  <meta name="msapplication-TileColor" content="">

  <meta name="theme-color" content="">

  
  <link rel="stylesheet" href="https://blog.v5u.win/css/bootstrap.min.css" />

  
  <title>V2ray记录 | 为吾优</title>
  

  <style>
body {
  min-width: 300px;
}

.custom-navbar {
  margin-bottom: 1em;
  height: 60px;
}

.custom-navbar a {
  display: inline-block; 
  padding: 18px 0;
  margin-right: 1em; 
  font-weight: bold; 
}

.custom-navbar a:hover,
.custom-navbar a:focus {
  text-decoration: none; 
}

@media print {
  .custom-navbar {
    display: none;
  }
}

article {
  padding-bottom: 1em;
}

img {
  max-width: 100%;
}


body {
  background-color: #fff;
}



body {
  color: #212529;
}



a {
  color: #007bff;
}



a:hover,
a:focus {
  color: #0056b3;
}



.custom-navbar {
  background-color: #212529;
}



.custom-navbar a {
  color: rgba(255,255,255,.75);
}



.custom-navbar a:hover,
.custom-navbar a:focus {
  color: rgba(255,255,255,1);
}



.container {
  max-width: 800px;
}





</style>
</head>

<body>
  <nav class="custom-navbar">
  <div class="container">
    
    <a href="/">文章</a>
    
    <a href="/tags/">标签</a>
    
    <a href="/about/">关于</a>
    
    <a href="/index.xml">RSS</a>
    
  </div>
</nav>
  
  <div class="container">
    <article>
      <h1>V2ray记录</h1>
<p>[TOC]</p>
<p>v2ray是什么？
v2是继小飞机ss之后的下一个技术方案。（不能明说）
v2 的优点：转发容易，匿名性高，可多级代理转发。
v2的缺点：配置相对复杂，客户端生态不完善。
下面从安装+使用，两个方面总结。
[TOC]
参考https://toutyrater.github.io/basic/vmess.html
环境建议：使用debain9，Ubuntu 16以上，不推荐centos</p>
<h2 id="安装">安装</h2>
<p>wget <a href="https://install.direct/go.sh">https://install.direct/go.sh</a>
bash go.sh
或
bash &lt;(curl -s -L <a href="https://install.direct/go.sh">https://install.direct/go.sh</a>)</p>
<h2 id="配置">配置</h2>
<p>vi /etc/v2ray/config.json</p>
<h2 id="启动">启动</h2>
<p>sudo systemctl start v2ray
在首次安装完成之后，V2Ray 不会自动启动，需要手动运行上述启动命令。而在已经运行 V2Ray 的 VPS 上再次执行安装脚本，安装脚本会自动停止 V2Ray 进程，升级 V2Ray 程序，然后自动运行 V2Ray。在升级过程中，配置文件不会被修改。
对于安装脚本，还有更多用法，在此不多说了，可以执行 bash go.sh -h 看帮助。
使用
service v2ray start
service v2ray status
有时候无法连接Google ，服务器没有问题，需要重启一下客户端。
客户端 列表
<a href="https://www.v2ray.com/awesome/tools.html">https://www.v2ray.com/awesome/tools.html</a>
安装后的显示信息：</p>
<pre tabindex="0"><code>Extracting V2Ray package to /tmp/v2ray.
Archive:  /tmp/v2ray/v2ray.zip
  ...
PORT:123456
UUID:xxx
Updating software repo
Installing daemon
</code></pre><p>centos6 问题解决 uninstall daemon &amp; systemctl not found
因为 centos6没有 systemctl 并且，v2ray不支持 centos6
<a href="https://hellojxl.com/2018/07/27/v2ray%E5%AE%89%E8%A3%85%E6%B3%A8%E6%84%8F%E8%AE%B0%E5%BD%95/">https://hellojxl.com/2018/07/27/v2ray%E5%AE%89%E8%A3%85%E6%B3%A8%E6%84%8F%E8%AE%B0%E5%BD%95/</a>
开机启动</p>
<pre tabindex="0"><code>    vi /etc/init.d/v2ray
    #!/bin/sh
    #
    # v2ray        Startup script for v2ray
    #
    # chkconfig: - 24 76
    # processname: v2ray
    # pidfile: /var/run/v2ray.pid
    # description: V2Ray proxy services
    #
    ### BEGIN INIT INFO
    # Provides:          v2ray
    # Required-Start:    $network $local_fs $remote_fs
    # Required-Stop:     $remote_fs
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: V2Ray proxy services
    # Description:       V2Ray proxy services
    ### END INIT INFO
    DESC=v2ray
    NAME=v2ray
    DAEMON=/usr/bin/v2ray/v2ray
    PIDFILE=/var/run/$NAME.pid
    LOCKFILE=/var/lock/subsys/$NAME
    SCRIPTNAME=/etc/init.d/$NAME
    RETVAL=0
    DAEMON_OPTS=&#34;-config /etc/v2ray/config.json&#34;
    # Exit if the package is not installed
    [ -x $DAEMON ] || exit 0
    # Read configuration variable file if it is present
    [ -r /etc/default/$NAME ] &amp;&amp; . /etc/default/$NAME
    # Source function library.
    . /etc/rc.d/init.d/functions
    start() {
      local pids=$(pgrep -f $DAEMON)
      if [ -n &#34;$pids&#34; ]; then
        echo &#34;$NAME (pid $pids) is already running&#34;
        RETVAL=0
        return 0
      fi
      echo -n $&#34;Starting $NAME: &#34;
      mkdir -p /var/log/v2ray
      $DAEMON $DAEMON_OPTS 1&gt;/dev/null 2&gt;&amp;1 &amp;
      echo $! &gt; $PIDFILE
      sleep 2
      pgrep -f $DAEMON &gt;/dev/null 2&gt;&amp;1
      RETVAL=$?
      if [ $RETVAL -eq 0 ]; then
        success; echo
        touch $LOCKFILE
      else
        failure; echo
      fi
      return $RETVAL
    }
    stop() {
      local pids=$(pgrep -f $DAEMON)
      if [ -z &#34;$pids&#34; ]; then
        echo &#34;$NAME is not running&#34;
        RETVAL=0
        return 0
      fi
      echo -n $&#34;Stopping $NAME: &#34;
      killproc -p ${PIDFILE} ${NAME}
      RETVAL=$?
      echo
      [ $RETVAL = 0 ] &amp;&amp; rm -f ${LOCKFILE} ${PIDFILE}
    }
    reload() {
      echo -n $&#34;Reloading $NAME: &#34;
      killproc -p ${PIDFILE} ${NAME} -HUP
      RETVAL=$?
      echo
    }
    rh_status() {
      status -p ${PIDFILE} ${DAEMON}
    }
    # See how we were called.
    case &#34;$1&#34; in
      start)
        rh_status &gt;/dev/null 2&gt;&amp;1 &amp;&amp; exit 0
        start
        ;;
      stop)
        stop
        ;;
      status)
        rh_status
        RETVAL=$?
        ;;
      restart)
        stop
        start
        ;;
      reload)
        reload
      ;;
      *)
        echo &#34;Usage: $SCRIPTNAME {start|stop|status|reload|restart}&#34; &gt;&amp;2
        RETVAL=2
      ;;
    esac
    exit $RETVAL
</code></pre><h2 id="增加权限并加入开机启动">增加权限并加入开机启动</h2>
<pre tabindex="0"><code>    chmod a+x /etc/init.d/v2ray
    chkconfig v2ray on
    service v2ray start
</code></pre>
    </article>
  </div>

  
  
  

  
</body>

</html>